class Solution
{
public:
    int countHomogenous(string s)
    {
        long long result = 0;
        long long continuousLen = 1;
        int n = s.size();
        for (int i = 1; i < n; ++i)
        {
            if (s[i] == s[i - 1])
            {
                ++continuousLen;
            }
            else
            {
                result += continuousLen * (continuousLen + 1) / 2;
                result %= 1000000007;
                continuousLen = 1;
            }
        }
        result += continuousLen * (continuousLen + 1) / 2;
        result %= 1000000007;
        return result;
    }
};